<CFPARAM NAME="CLIENT.edtDateFrom" DEFAULT="#CreateODBCDate(Now())#">
<CFPARAM NAME="CLIENT.edtDateTO" DEFAULT="#CreateODBCDate(Now())#">

<CFINCLUDE TEMPLATE="../common/popdate.cfm">
<SCRIPT language="JavaScript1.2">
	function ShowCalendar(FormName, FieldName) {
			quickpopdate(FormName, FieldName)
	}
</SCRIPT>
<CFQUERY NAME="getPowerUser" DATASOURCE="#client.company_dsn#">
	SELECT A.PERSONNELIDNO, B.LASTNAME,B.FIRSTNAME
	FROM CINWSPOWERUSER A, CMFPA B
	WHERE A.PERSONNELIDNO=B.PERSONNELIDNO
		AND A.PERSONNELIDNO='#client.chapa#'
</CFQUERY>
<CFSET isPowerUser=FALSE>
<CFIF getPowerUser.RECORDCOUNT>
	<CFSET isPowerUser=TRUE>
</CFIF>
<CFSET sFrom=CreateODBCDate(Now())>
<CFSET sTo=CreateODBCDate(Now())>
<cfif CLIENT.edtDateFrom neq "" and CLIENT.edtDateTO neq "">
	<CFSET sFrom=CreateODBCDate(CLIENT.edtDateFrom)>
    <CFSET sTo=CreateODBCDate(CLIENT.edtDateTo)>
</cfif>
<CFSET myID="">
<CFOUTPUT>
<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="Select Date Range">
	<FORM ACTION="index.cfm?recordview=&id=#url.id#" METHOD="post" ONSUBMIT="return CheckField();" NAME="frmSchedView">
		<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
			<TR>
				<TD WIDTH = "10%">Date From:</TD>
				<TD WIDTH = "1%">*</TD>
				<TD>
					<INPUT TYPE="TEXT" NAME="edtDateFrom" VALUE="#DateFormat(sFrom,'mm/dd/yyyy')#" SIZE="10">
					<A HREF="javascript:quickpopdate('frmSchedView','edtDateFrom');"><IMG SRC="#client.icon_path#calendar.gif" BORDER="0" ALT="View Calendar" ALIGN="bottom"></A>
				</TD>	
			</TR>
			<TR>
				<TD>Date To:</TD>
				<TD>*</TD>
				<TD>
					<INPUT TYPE="TEXT" NAME="edtDateTo" VALUE="#DateFormat(sTo,'mm/dd/yyyy')#" SIZE="10">
					<A HREF="javascript:quickpopdate('frmSchedView','edtDateTo');"><IMG SRC="#client.icon_path#calendar.gif" BORDER="0" ALT="View Calendar" ALIGN="bottom"></A>
				</TD>
			</TR>
			<TR>
				<TD COLSPAN="3">
					<hr>
				</TD>
			</TR>
			<TR>
				<TD COLSPAN="3">
					<CFIF isPowerUser>
						<INPUT CLASS="bitbtn" TYPE="submit" NAME="btnSelEmp" VALUE="Select Employee">&nbsp;&nbsp;
					<CFELSE>
						<INPUT CLASS="bitbtn" TYPE="submit" NAME="btnProceed" VALUE="Proceed">
					</CFIF>
					<INPUT CLASS="bitbtn" TYPE="submit" NAME="btnBackHome" VALUE="Back">
				</TD>
			</TR>
		</TABLE>
	</FORM>
	<CFIF NOT isPowerUser>
	<CFQUERY NAME="getMyInfo" DATASOURCE="#client.company_dsn#">
		SELECT PERSONNELIDNO,LASTNAME,FIRSTNAME
		FROM CMFPA 
		WHERE PERSONNELIDNO='#client.chapa#'
	</CFQUERY>
		<CFSET myID="#getMyInfo.PERSONNELIDNO#~#getMyInfo.Firstname#&nbsp;#getMyInfo.LASTNAME#">
	</CFIF>
	<CFIF (isdefined("form.btnAddEmp") AND isdefined("form.chkPERSONNELIDNO") and form.chkPERSONNELIDNO neq "") OR (myID NEQ "" AND isdefined("form.btnProceed"))>
		<CFIF myID NEQ "">
			<CFSET form.chkPERSONNELIDNO=myID>
		</CFIF>
		<CFLOOP LIST="#form.chkPERSONNELIDNO#" INDEX="USER">
			<CFSET appno=LISTGETAT(USER,1,"~")>
			<CFSET sUSERID=LISTGETAT(USER,2,"~")>
			<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TITLE="#sUSERID#  -  #appno#">
				<TABLE BORDER="0" WIDTH="100%">
                	<TR ALIGN="CENTER" BGCOLOR="#client.color_tblhead#">
						<TD WIDTH="15%" CLASS="boldwhite">Reference Date</TD>
                        <TD WIDTH="10%" CLASS="boldwhite">Leave</TD>
						<TD WIDTH="20%" CLASS="boldwhite">Schedule</TD>
						<TD WIDTH="10%" CLASS="boldwhite">Day Type</TD>
						<TD WIDTH="10%" CLASS="boldwhite">Sched In</TD>
						<TD WIDTH="10%" CLASS="boldwhite">Sched Out</TD>
						<TD WIDTH="10%" CLASS="boldwhite">Category</TD>
						<TD CLASS="boldwhite">Sched Type</TD>
					</TR>
					<CFSET rowCounter=0>
					<CFIF CLIENT.edtDateFrom NEQ "" AND CLIENT.edtDateTo NEQ "">
						<CFSET sFolder = "daterange">
						<CFSET sFrom=dateformat(CLIENT.edtDateFrom,"mm/dd/yyyy")>
						<CFSET sTo=dateformat(CLIENT.edtDateTo,"mm/dd/yyyy")>
						<cfset session.ppp=sFrom>
						<cfset session.ppap=sTo>
						<CFLOOP CONDITION="#sFrom# LTE  #sTo#">
							<CFINCLUDE TEMPLATE="../common/getsched.cfm">
							<CFIF varPATTERNCODE NEQ "">
								<CFSET rowCounter=rowCounter+1>
								<TR ALIGN="CENTER" BGCOLOR="#IIf(rowCounter Mod 2, "client.color_tblset1", "client.color_tblset2")#" >
									<TD nowrap WIDTH="15%" ALIGN="CENTER">
										&nbsp;<cfoutput>#DateFormat(sFrom,"MMM. - DD")#</cfoutput>&nbsp;
									</TD>
                                    <TD nowrap WIDTH="10%" >
                                    	&nbsp;#sLeave#&nbsp;
                                    </TD>
									<TD nowrap WIDTH="25%" >
										&nbsp;#varPATTERNCODEDesc#&nbsp;
									</TD>
									<TD nowrap WIDTH="10%" >
										&nbsp;#sDAYTYPE#&nbsp;
									</TD>
									<TD nowrap WIDTH="10%" >
										&nbsp;#getlkDTL.TIMEIN#&nbsp;
									</TD>
									<TD nowrap WIDTH="10%" >
										&nbsp;#getlkDTL.TIMEOUT#&nbsp;
									</TD>
									<TD nowrap WIDTH="10%">
										&nbsp;#sCATEGORY#&nbsp;
									</TD>
									<TD nowrap>
										&nbsp;#varSchedType#&nbsp;
									</TD>
								</TR>
							</CFIF>
							<CFSET sFrom=dateformat(dateadd("d",1,sFrom),"mm/dd/yyyy")>
						</CFLOOP>
						<TR>
							<TD COLSPAN=7 ><i>Dates with no record were not displayed</i></TD>
						</TR>
					</CFIF>
						<TR BGCOLOR="#client.color_tblhead#">
							<TD CLASS="boldwhite" COLSPAN=7 ><b>#rowCounter# records found for the range</b></TD>
						</TR>
				</TABLE>
			<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
		</CFLOOP>
	</CFIF>
<CFMODULE TEMPLATE="#client.common_path#cfm_wswindow.cfm" TOP="False">
</CFOUTPUT>
